package com.molichuxing.services.property;


/**
 * 具体险种名称(车辆损失险:vehicle_loss_lnsurance,第三者责任险:third_party_liability_insurance,基本不计免赔:basically_no_deductible)
 * @author xuelin yi
 */
public enum CarInsuranceNameEnum {

	/**
	 * 车辆损失险
	 */
	VEHICLE_LOSS_LNSURANCE("vehicle_loss_lnsurance", "车辆损失险"),
	/**
	 * 第三者责任险
	 */
	THIRD_PARTY_LIABILITY_INSURANCE("third_party_liability_insurance", "第三者责任险"),
	/**
	 * 基本不计免赔
	 */
	BASICALLY_NO_DEDUCTIBLE("basically_no_deductible", "基本不计免赔");


	String value;
	String name;

	CarInsuranceNameEnum(String value, String name) {
		this.value = value;
		this.name = name;
	}

	public String getValue() {
		return value;
	}

	public String getName() {
		return name;
	}


	/**
	 * 通过value获取枚举的name
	 * 
	 * @param value
	 * @return
	 */
	public static String getName(String value) {
		CarInsuranceNameEnum enumerate = getEnum(value);
		return enumerate == null ? null : enumerate.getName();
	}

	/**
	 * 通过value获取枚举
	 * 
	 * @param value
	 * @return
	 */
	public static CarInsuranceNameEnum getEnum(String value) {
		for (CarInsuranceNameEnum enumerate : CarInsuranceNameEnum.values()) {
			if (enumerate.getValue() == value) {
				return enumerate;
			}
		}
		return null;
	}
}
